import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/api/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/api/getuserinfo',
    method: 'get'/* ,
    params: { token } */
  })
}


export function logout() {
  return request({ 
    url: '/api/logout',
    method: 'post'
  })
}

export default   {
  fetchList: function(query) {
    return request({
      url: '/api/admin/user/list',
      params: query
    })
  },
  fetchOne: function(id) {
    return request({
      url: '/api/admin/user/get/' + id,
      method: 'get'
    })
  },
  delete: function(id) {
    return request({
      url: '/api/admin/user/delete/' + id,
      method: 'get'
      /*,
          params: { pv }*/
    })
  },
  add: function(data) {
    return request({
      url: '/api/admin/user/add',
      method: 'post',
      data
    })
  },
  update: function(data) {
    return request({
      url: '/api/admin/user/update',
      method: 'post',
      data
    })
  }
}
